#include "widget.h"
#include "ui_widget.h"
#include <QTimerEvent>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    timeId= startTimer(1000);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::timerEvent(QTimerEvent *event)
{
    if(event->timerId()==timeId)
    {
        int val = ui->lcdNumber->intValue();
        if(val<=0)
        {
            killTimer(timeId);
            return;
        }
        val--;
        ui->lcdNumber->display(val);
    }
}

